#!/bin/bash

#. "/home/st/.bashrc"

filename="${PATH_MAIN_REPO_FN_DIR}/dir_upg_path_/upg_path_tst/exec.tst" 

# echo -e "${HLIGHT}---start file://$filename ---${NORMAL}" # start file

idir=$(pwd)

# cd "$(prs_f -d $filename)" || qq_exit "$(prs_f -d filename) not found"

dir=$(prs_f -d "$filename")
cd "$dir" || plt_exit
. "$dir"/_flow_tst.sh &>/dev/null
# . "$dir"/_flow_tst.sh &>res

# cd "$dir"/use/ || qq_exit

# ./main.bexe &>res

flag=1
if ! diff -q ""$dir"/file_to_upg.res" ""$dir"/file_to_upg.demand" >/dev/null; then
    flag=0
fi

if [ 0 -eq "$flag" ]; then
    echo "ANY in $dir fail" >&2
    diff ""$dir"/file_to_upg.res" ""$dir"/file_to_upg.demand" >&2
    return 1
else
    echo "ALL in $dir true"
    return 0
fi

cd "$idir"

unset filename